home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 3
/
Cream of the Crop 3.iso
/
utility
/
clustr.zip
/
CLUSTER.DOC
< prev
next >
Wrap
Text File
|
1993-11-19
|
16KB
|
339 lines
╒══════════════════════════════════════════════════════════════╕
│ Note bene: Use the <Esc> key to EXIT when finished reading │
╘══════════════════════════════════════════════════════════════╛
Clusters, Sectors and -BIG- Hard Drives
18 November, 1993
6:41 PM
Last week I uploaded to CompuServe a simple program called
CLUSTER.COM. This is "son of CLUSTER.COM" with more bells and
whistles.
CLUSTER.COM's main purpose is to inform you folk who are buying
a new humongous hard drive (greater than 127 Megabytes) how to
set up that new hard drive to have the smallest Clusters.
One file occupies one Cluster. If the file is 1 byte long and
your Cluster size is "8 K" then there are 8,195 empty bytes
sitting on your hard drive that no other file can use. For lack
of a better term let's call that empty space "Slack Space," and
while I am at it, allow me to use the abbreviation "K" for
Kilobytes and "MB" for Megabytes.
The reason I got into all of this weird stuff about Clusters
and Sectors is that my very first computer was a 100 MB Zenith
laptop that I bought on sale. As that hard drive filled up, I
noticed that there was a lot of "Slack Space." Slack Space is
hard drive disk space not used by files. So even though I had a
100 MB hard drive, I ran out of room at about 88 MB of files.
That's when I discovered that with DOS 3.3 and one large hard
drive partition, I had 8 K Clusters. That was with DOS 3.3, DOS
5.0 does not do that.
So now.. the little light bulb probably has gone on in your
head as you realize that if you have eight kilobyte Clusters
and a lot of little files... you are LOSING MEGABYTES OF DISK
SPACE.
The answer to large Cluster size on your hard drive (IF your
hard drive has 4 or 8 K Clusters), is to FDISK.EXE and
FORMAT.COM the hard drive (using DOS 5.0 or better) to make
MULTIPLE PARTITIONS. Do this ONLY AFTER you have backed up all
your files to diskettes and TEST the restore process, or after
using two tapes to back up and compare your programs and files.
Being just an information source, it doesn't sound like
CLUSTER.COM will win the Nobel Peace prize... does it? Some of
you are saying you can get all this stuff by using CHKDSK.EXE
which comes with DOS. True, true just typing "CHKDSK C:" on the
DOS command line and "executing" that command will give you
your Cluster size and hard disk size. See... I just "shelled to
DOS" and did that for you:
───────────────────────────────────────────────────────────────
Volume Serial Number is 1B6C-A179
104,380,416 bytes total disk space
79,872 bytes in 2 hidden files
362,496 bytes in 105 directories
95,496,192 bytes in 6,650 user files
262,144 bytes in bad sectors
8,179,712 bytes available on disk
2,048 bytes in each allocation unit
50,967 total allocation units on disk
3,994 available allocation units on disk
655,360 total bytes memory
347,296 bytes free
Instead of using CHKDSK, try using SCANDISK. SCANDISK can
reliably detect and fix a much wider range of disk
problems. For more information, type HELP SCANDISK from
the command prompt.
───────────────────────────────────────────────────────────────
See those "Clusters?" No? Well DOS calls "Clusters" "allocation
units." The example above shows that this little ole laptop has
a Cluster size of 2,048 bytes. That is the -smallest- sized
cluster you can have on a DOS hard drive. Sure you can have
Clusters as small as one Sector, or 512 bytes on your RAM drive
but that is a "logical" drive not a "real" drive. Floppies
usually have a Cluster size of 1024 bytes. If you remember just
this, you know more about Clusters and Sectors than most
computer salesmen.
CLUSTER.COM gives you the results of some mathematical formulas
to calculate "bytes," "kilobytes," and "megabytes." Then let's
you know what the maximum size hard drive you can make with:
1. 2 kilobyte Clusters (2048 bytes/Cluster)
2. 4 kilobyte Clusters (4096 bytes/Cluster)
3. 8 kilobyte Clusters (8196 bytes/Cluster)
A "kilobyte" is NOT one-thousand (1,000) bytes but one-thousand
and twenty-four (1,024) bytes. This kind of stuff makes me
CRAZY as the prefix "kilo" means thousand so that a "kilogram"
is a thousand grams and all other "kilos" are a nice round
thousand... except in computer terms.
I have asked some of the "computer experts" I know to explain
how come a "kilobyte" (K) is 1,024 bytes and a "megabyte" (MB)
is 1,048,576 bytes. They tell me it makes perfect sense to
them... but they CAN'T explain it to me.
A byte stores the computer data for a single character. By some
strange thinking it was decided that a kilobyte is "2 to the
10th power" or as QuickBASIC likes to see that formula as:
"2^10." And... a megabyte is: "2^20."
This is where CLUSTER.COM comes in. After you read this stuff
and exit the text file by pressing <Esc>, you can find out how
many 2K Cluster, 127 MB Partitions you should make for your new
huge hard drive.
According to my favorite PC Reference, "DOS Power Tools, 2nd
Edition, Revised for DOS 5.0; by Paul Somerson, 1991, page
763"; there are only a total of 65,518 CLUSTERS in a hard drive
Partition. Each file's location information requires one byte
located in one DOS Segment. One DOS Segment has 65,536 bytes.
We know that 16 bytes are needed for the "Partition Loader" per
Partition so that 2 bytes are used for something else.
PC Magazine and others have written about Clusters and used the
number 65,536 to calculate the maximal hard drive size, and...
they are WRONG. The correct number is 65,518. Therefore the
MAXIMAL hard drive that you can make is NOT 128 MB as others
may have told you, but 127. The math is simple.
If you are one of my "Junior Propeller Hat" friends and have
looked at CLUSTER.BAS in dismay because it contains code that
doesn't look like QuickBASIC... be of good cheer, if you know a
modest amount of QuickBASIC, you can translate it into a one-
hundred percent QuickBASIC program and run it. If you can't,
give me a "ring" and I'll show you how. CLUSTER.BAS has
Crescent Software's PDQ code as otherwise the executable file
CLUSTER.COM, would be over 66 K in size.
And lastly, I have included two references from Microsoft's
Knowledge Base Forum on CompuServe that speak to this stuff,
just so you know I am giving you the "straight skinny."
John De Palma on CompuServe 76076,571
REFERENCES
───────────────────────────────────────────────────────────────
Knowledge Base CIS
Title: MS-DOS Partitioning Summary
Document Number: Q69912
Publ Date: 24-AUG-1993
Product Name: Microsoft Disk Operating System Product Version: 2.x 3.x
4.x 5.x 6.00 Operating System: MS-DOS
----------------------------------------------------------------
The information in this article applies to:
- Microsoft MS-DOS operating system version 2.x, 3.x, 4.x, 5.x, and
6.0
--------------------------------------------------------
SUMMARY =======
This article contains a summary of MS-DOS partitioning information.
For information on how MS-DOS assigns drive letters, query on the
following words in the Microsoft Knowledge Base:
msdos and order and assign and drive and letter
MORE INFORMATION ================
A hard disk's master boot record (MBR) is located in the first sector
of the disk (cylinder 0, side 0, sector 1). The partition table is
located at offset 01BE, containing up to four 16-byte entries. The
fourth byte of each partition table entry is used to mark the
partition type.
MS-DOS began supporting hard disks in version 2.0. In MS-DOS versions
2.x, MS-DOS supports one type 01 partition of up to 32 megabytes (MB)
in size, which use a 12-bit file allocation table (FAT). FDISK creates
only one MS-DOS partition per drive.
In MS-DOS 3.0, partitions larger than 15 MB use a 16-bit FAT, which
allows a smaller cluster size and thus more efficient disk usage. As a
result, MS-DOS 2.x hard drives larger than 15 MB are incompatible with
later versions of MS-DOS. Again, FDISK creates only one MS-DOS
partition per drive.
In version 3.3, MS-DOS introduced support for more than one logical
drive per hard disk. Logical drives are treated as completely separate
disks under MS-DOS, even though they may occupy the same physical hard
disk.
This was supported by introducing nonbootable MS-DOS partitions known
as extended MS-DOS partitions. FDISK reports these as EXT DOS; other
MS-DOS partitions began to be reported as PRI DOS, for primary MS-DOS.
Each primary MS-DOS partition is a logical drive, and extended MS-DOS
partitions contain from 1 to 23 logical drives (MS-DOS supports drive
letters up to Z). Logical drives in extended MS-DOS partitions have
the same FAT type as a primary MS-DOS partition of the same size.
Only one PRI DOS partition and one EXT DOS partition is allowed per
drive. On machines with two physical hard drives, a PRI DOS partition
is not required on the second physical disk. A PRI DOS partition is
required on the first physical disk. (MS-DOS would not support more
than two physical disks.)
Version 4.0 introduced logical drives larger than 32 MB. Full usage of
these logical drives requires the MS-DOS program SHARE.EXE to be
loaded.
The following table explains the current (versions 4.x through 6.0)
MS-DOS partition types:
Partition FDISK Introduced
Type Reports Size FAT Type in MS-DOS
Version
--------- ------- ------ --------- -----------
01 PRI DOS 0 - 15 MB 12-Bit 2.0 (a)
04 PRI DOS 16 - 32 MB 16-Bit 3.0
05 EXT DOS 0 - 2 GB (b) n/a 3.3
06 PRI DOS 32 MB - 2 GB (b) 16-bit 4.0
(a) 15 MB size limitation added in 3.0
(b) 2 GB (gigabytes) includes a limit of 1024 cylinders per drive
imposed by the standard AT ROM BIOS interrupt 13 protocol
MS-DOS versions 5.0 and 6.0 support the same partitioning strategy as
versions 4.x, including FDISK's refusal to create more than one
primary MS-DOS partition on a physical disk. However, because some
original equipment manufacturers (OEMs) allow more then one primary
MS-DOS partition, MS-DOS 5.0 and 6.0 support more than one primary MS-
DOS partition on a physical disk for compatibility reasons.
MS-DOS 5.0 and 6.0 also support up to eight physical hard drives.
SHARE.EXE is not required for full large-drive support; this support
is included in the MS-DOS kernel.
NOTE: Many OEMs have changed their MS-DOS to support more than one
primary MS-DOS partition, larger type 04 partitions, and/or introduced
new partition types.
Additional reference words: 3.0 3.00 3.10 3.1 3.3 3.30 3.3a 3.30a 4.0
4.00 4.01 4.01a 5.00 5.0 5.00a 5.0a 6.0
COPYRIGHT Microsoft Corporation, 1993.
_________________________________________________________________
Knowledge Base CIS
Title: FAT Type and Cluster Size Depends on Logical Drive Size
Document Number: Q67321
Publ Date: 4-NOV-1993
Product Name: Microsoft Disk Operating System Product Version: 3.x 4.x
5.x 6.00 6.20 Operating System: MS-DOS
---------------------------------------------------------------- The
information in this article applies to:
- Microsoft MS-DOS operating system versions 3.x, 4.x, 5.x, 6.0 and
6.2 --------------------------------------------------------
SUMMARY =======
MS-DOS allocates disk space for files in units of one or more sectors;
these units are called "clusters" or "allocation units." On any MS-DOS
disk, a 1-byte file is allocated 1 cluster of disk space, wasting the
unused area of the cluster. A file that is 3.2 clusters large is given
4 clusters. Overall, a smaller cluster size means less waste.
The cluster size for a drive is decided by FORMAT, depending on the
size of the logical drive (see table, below). "Logical drive" refers
to an MS-DOS volume accessed by a drive letter (A:, B:, C:, D:, and so
forth). Hard disk users may want to consider cluster size when
choosing how to partition their drive(s).
The cluster size of a floppy drive cannot be changed. The cluster size
of a hard drive can be changed only by changing the size of the
logical drive, which is done by repartitioning the hard drive.
CHKDSK displays the allocation unit size for a logical drive. FDISK's
option 4 displays the size(s) of logical drives on the hard drive(s).
NOTE: DoubleSpace-compressed drives appear to have 8K clusters, but
internally vary the sectors-per-cluster as necessary (this information
is recorded in the MDFAT). For example, a 10K file which compresses by
a factor of 2:1 actually uses 5K, or 10 sectors, of drive space.
MORE INFORMATION ================
The following is a table of logical drive sizes, FAT (File Allocation
Table) types, and cluster sizes:
Table) types, and cluster sizes:
Drive Size FAT Type Sectors Cluster
(logical volume) Per Cluster Size
---------------- -------- ----------- -------
(Floppy Disks) 360K 12-bit 2 1K
720K 12-bit 2 1K
1.2 MB 12-bit 1 512 bytes
1.44 MB 12-bit 1 512 bytes
2.88 MB 12-bit 2 1K
(Hard Disks) 0 MB - 15 MB 12-bit 8 4K
15 MB - 127 MB 16-bit 4 2K
128 MB - 255 MB 16-bit 8 4K
256 MB - 511 MB 16-bit 16 8K
512 MB - 1023 MB 16-bit 32 16K
1024 MB - 2048 MB 16-bit 64 32K
NOTES:
- Sectors are 512 bytes in size, except on some RAM drives.
- In the past, some OEMs have modified their versions of MS-DOS to
support other sector and/or cluster sizes. The Microsoft MS-DOS 5
Upgrade Setup will, if possible, convert the logical drive to MS-DOS
5.0 compatible. This entails converting the sector size to 512 bytes
while retaining the nonstandard cluster size.
- MS-DOS determines the FAT size based on the number of clusters. If
there are 4085 or fewer clusters, a 12-bit FAT is used. If there are
4086 or more clusters, a 16-bit FAT is used.
For more information on this topic, query on the following words:
cluster and disk and FAT
Additional reference words: 3.20 3.21 3.30 3.30a 4.00 4.01 5.00 5.00a
partition allocation unit 6.00 6.20
COPYRIGHT Microsoft Corporation, 1993.